/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include "Widget.h"


void f_填充布局(C_Widget* r, C_Widget** w, uint32 num);

void f_散列布局(C_Widget* r, C_Widget** w, uint32 num);

float32	f_HBOX布局(vec2 pos, vec2 size, C_Widget** w, uint32 num);
float32	f_VBOX布局(vec2 pos, vec2 size, C_Widget** w, uint32 num);
float32	f_Layout_网格(vec2 pos, vec2 size, C_Widget** w, uint32 num);
void	f_HBOX布局(C_Widget* r, C_Widget** w, uint32 num);
void	f_VBOX布局(C_Widget* r, C_Widget** w, uint32 num);
void	f_Layout_网格(C_Widget* r, C_Widget** w, uint32 num);
void	f_Layout_网格(C_Widget* r, C_Widget** w, uint32 num, uint32 横向数量, float32 边距 = 1, const vec2& 偏移 = {});
void	f_Layout_网格(C_Widget** w, uint32 num, uint32 横向数量, float32 边距 = 1, const vec2& 偏移 = {}, const vec2& 大小 = {});


float32	f_HBOX固定布局(float32 maxWidth, C_Widget** w, uint32 num, vec2 offset, float32 间隔 = 0);
float32	f_VBOX固定布局(float32 maxWidth, C_Widget** w, uint32 num, vec2 offset, float32 间隔 = 0);



void f_布局_纵向滚动条(C_Widget* r, vec2 size, float32 间隙);
void f_布局_双向滚动条(C_Widget* r, E_方向 方向, float32 间隙);

void f_布局_滚动框视口(C_Widget* r, C_Widget* view);

bool f_布局_扩展视口纵向滚动(C_Widget* self, C_Widget* view, float32 滚动步进);
bool f_布局_组件纵向滚动(C_Widget* self, C_Widget* view, float32 滚动步进);

void on_滚动框_列表布局(C_Widget* self, C_Widget** w, uint32 num);


struct S_填充布局 : public S_布局器 {
	vec4	m_边距;
	vec2	m_Size;
	void f_poll(struct C_Widget** ws, uint32 num);
};



struct S_比例布局 : public S_布局器 {
	vec2	m_位置比例;
	vec2	m_大小比例;
	vec2	m_大小;
	void f_poll(struct C_Widget** ws, uint32 num);
};




struct S_V排列布局 : public S_布局器 {
	std::vector<bool> m_是否拉伸;
	void f_poll(struct C_Widget** ws, uint32 num);
};








/****************************************************************
*           文字绘制帮助
*****************************************************************/
vec2 f_widget_get文字绘制据中偏移(C_Widget* w, const std::wstring& te, const S_Font& 字体, float32 间隔);

vec2 f_widget_get文字绘制据中偏移(const vec2& size, const std::wstring& text, const S_Font& 字体, float32 间隔);
vec2 f_widget_get文字左对齐偏移位置(const vec2& size, const std::wstring& text, const S_Font& 字体, float32 间隔);


//void f_layout_文字排版(S_2D文本对象& textOb);
//void f_layout_文字排版(mat3X2* textOb, std::vector<std::wstring>& texts);


